package com.yifan.testArray;

/**
 * @Author YIFan
 * @Date 2020/6/7 12:17
 * @Version 1.0
 */
// 线性查找 -- 效率低
public class TestSearch {
    public static void main(String[] args) {
        int[] arry = {2, 4, 5, 6, 7, 1, 9, 0};
        int target = 4;
        int index = -1;
        for (int i = 0; i < arry.length; i++) {
            if (arry[i] == target){
                index = i;
                break;
            }
        }
        System.err.println(target+"  --  index = "+index);


    }

}
